<%-- 
    Document   : cartmain
    Created on : Jan 21, 2012, 10:00:12 PM
    Author     : VIC
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="Beans.*,java.util.*,Models.*,java.text.NumberFormat"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
     <%
                int langid = (Integer) session.getAttribute("langid"); // ngôn ngữ hiện tại
                String dsts = "'accep','back','pay','invainfo','selecttb','cancel','finish','yousure','total' "; // chuỗi chứa các mã tham số của trang này.
                ThamSoHT[] mdsts = ThamSoHT_Model.DSThamSo(dsts, langid); // mảng chứa các tham số của trang này.
                String accep = mdsts[0].getTenTS();
                String back = mdsts[1].getTenTS();
                String cancel = mdsts[2].getTenTS();
                String finish = mdsts[3].getTenTS();
                String invalid = mdsts[4].getTenTS();
                String pay = mdsts[5].getTenTS();
                String selecttb = mdsts[6].getTenTS();
                String total = mdsts[7].getTenTS();
                String sure = mdsts[8].getTenTS();
                NumberFormat nf = NumberFormat.getNumberInstance(Locale.FRENCH);
    %>
<body onload="window.scrollTo(1, 0);">
        <%
            String ban = (String) request.getParameter("ban");
            Vector ctpdma = PhieuDatMA_Model.LoadCart(ban, langid);
            int size = ctpdma.size();
            double tongcong = 0;
       %>
       <div id="chitietphieu">
            <%
                for(int i=0; i<size;i++)
                {
                    String[] monan = (String[]) ctpdma.get(i);
                    if(!monan[4].equals("4"))
                    tongcong = tongcong +Double.parseDouble(monan[5]) * Double.parseDouble(monan[2]);
        %>
        <div class="cartitem" id="item<%=monan[0]%>">
                    <table>
                     <tr>
                        <td colspan="2" style="color: #FFEE88;width: 130px;"><%=monan[1]%></td>
                        <td style="width: 60px;"><%=nf.format(Double.parseDouble(monan[5])) %></td>
                        <td style="text-align: center;width: 50px;"> x <input disabled="true" value="<%=monan[2]%>" type="text" class="soluong"/> </td>
                        <td style="width: 80px;"><%=monan[3]%></td>
                    </tr>
                    <tr class="cartfunc">
                        <% if(monan[4].equals("1")) {%>
                        <td style="width: 50px;">                    
                            <img onclick="HoiThuc(<%=monan[0]%>,'<%=accep%>');" src="images/hurry.png"/>
                        </td>
                        <td style="width: 80px;"><label class="tt<%=monan[4]%>"><%=monan[6]%></label> </td>
                         <% } else {%>
                         <td style="width: 0px;"></td>
                         <td style="width: 130px;"><label class="tt<%=monan[4]%>"><%=monan[6]%></label> </td>
                        <% }%>
                        <td style="width: 60px;">
                             
                        </td>
                        <td style="width: 50px;">
                             <% if(monan[4].equals("1")) {%>
                            <img src="images/remove.png" onclick="XoaMon('<%=selecttb %>','<%=accep %>','<%=monan[0] %>');"/>
                            <% }%>
                        </td>
                        <td style="width: 80px;">
                            <%=nf.format(Double.parseDouble(monan[5]) * Double.parseDouble(monan[2])) %>
                        </td>
                    </tr>
                    </table>
                        </div>
        <% } %>
        <div style="margin-left: 20px; margin-top: 10px;color: yellow;font-size: 17px;"><%=total %> : <%=nf.format(tongcong) %></div>
        <div id="cartbutton">
            <input class="simplemodal-close" onclick="$.modal.close();"  type="button" value="<%=back %>" />
            <input  onclick="TinhTien('<%=accep %>','<%=cancel %>','<%=sure%>');"  type="button" value="<%=pay %>" />
        </div>
        </div>
    </body>
</html>
